package cn.edu.zafu.bigdata.hdb;
    class Vehicle {
        public void move() {
            System.out.println("Vehicle is moving");
        }
    }
    class Car extends Vehicle {
        public void move() {
            System.out.println("Car is moving");
        }
    }
    class Bicycle extends Vehicle{
        public void move(){
            System.out.println("Bicycle is moving");
        }
    }
public class TestVehicle {
    public static void main(String [] args) {
        Vehicle[] vehicles = new Vehicle[2];
        vehicles[0] = new Car();
        vehicles[1] = new Bicycle();

        // 遍历数组并调用move()方法展示多态性
        for (Vehicle vehicle : vehicles) {
            vehicle.move(); // 根据实际对象调用相应的move方法
        }
    }
}
